package com.lzw.breezeNovel.webApp.controller.video;


import com.lzw.breezeNovel.common.result.Result;
import com.lzw.breezeNovel.model.entity.pojo.video.ShortComment;
import com.lzw.breezeNovel.model.entity.query.PaginationResultQuery;
import com.lzw.breezeNovel.webApp.service.video.ShortCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.controller.video
 * @date 2025/3/23
 * @description 评论的controller
 */
@RestController
@RequestMapping("/app/shortComment")
@SuppressWarnings("all")
public class ShortCommentController {

    /**
     * 注入service
     */
    @Autowired
    private ShortCommentService shortCommentService;

    /**
     * 发表评论
     */
    @RequestMapping("/add")
    public Result add(@RequestParam String content,@RequestParam Long shortId) {
        shortCommentService.add(content,shortId);
        return  Result.ok();
    }

    /**
     * 分页获取所以的评论
     */
    @RequestMapping("/list")
    public Result<PaginationResultQuery<ShortComment>> list(@RequestParam Long shortId,@RequestParam Integer pageNo,@RequestParam Integer size) {
        PaginationResultQuery<ShortComment> shortCommentPaginationResultQuery = shortCommentService.list(shortId, pageNo, size);
        return Result.ok(shortCommentPaginationResultQuery);
    }

}
